package br.ufrgs.dbproject.sax;

import org.xml.sax.Attributes;

import br.ufrgs.dbproject.algorithm.IDStrategy;
import br.ufrgs.dbproject.pathcache.CacheEntry;

public class Node implements ParentNode {

	private final int documentID;
	private final IDStrategy id;
	private final CacheEntry cachedPath;
	private final String tagName;
	private final Attributes attributes;
	private String text;
	
	protected Node(int documentID, IDStrategy id, CacheEntry cacheEntry, String tagName, Attributes attributes) {
		this.documentID = documentID;
		this.id = id;
		this.cachedPath = cacheEntry;
		this.tagName = tagName;
		this.attributes = attributes;
	}
	
	public Node createChild(CacheEntry cacheEntry, String tagName, Attributes attributes) {
		return new Node(documentID, id.createChild(), cacheEntry, tagName, attributes);
	}
	
	public IDStrategy getId() {
		return id;
	}
	
	public CacheEntry getPath() {
		return cachedPath;
	}
	
	public String getTagName() {
		return tagName;
	}
	
	public Attributes getAttributes() {
		return attributes;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public int getDocumentID() {
		return documentID;
	}
}
